const app = getApp()
const {getRouter} = require('../../utils/router.js')
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    url: {
      type: String
    },
    showIndex:Number
  },
  /**
   * 组件的初始数据
   */
  data: {
    currentIndex: null,
    isIpx: app.globalData.isIpx,
    msg: {
      failMsg: '你必须授权'
    }
  },
  ready () {
    this.router = getRouter()
    this.changeEvent(this.data.showIndex)
  },

  methods: {
    changePage (e) {
      this.changeEvent(e.currentTarget.dataset.index)
    },
    changeEvent (index) {
      if (index === this.data.currentIndex) return
      this.setData({
        currentIndex: index
      })
      this.router.navigateTo(index)
      // if(index == 0){
      //   this.router.navigateTo('/1/3')
      // } else {
      //   this.router.navigateTo(index)
      // }
    },
  }
})
